package com.lession1;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class IpStudy {

    public static void main(String[] args) {
        try {
            //查询本机ip
            System.out.println(InetAddress.getLocalHost());

            //查询网站ip地址
            InetAddress inetAddress3 = InetAddress.getByName("www.baidu.com");
            System.out.println(inetAddress3);

        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }

}
